package com.jzsec.proxy.jzsecproxy.config;

import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class HttpClientConfiguration {

	@Bean
	public OkHttpClient getOkHttpClient() {
		OkHttpClient.Builder builder = new OkHttpClient.Builder();
		OkHttpClient okHttpClient = builder.connectTimeout(3, TimeUnit.SECONDS)
				.readTimeout(5, TimeUnit.SECONDS)
				.writeTimeout(5, TimeUnit.SECONDS)
				.retryOnConnectionFailure(true)
				.build();
		return okHttpClient;
	}

}
